#ifndef _APP_DEF_H_
#define _APP_DEF_H_
#include "stdio.h"
#include "stm32wlxx_hal.h"

enum EXT_IO_ID{
    LORA_STATUS_RED,
    LORA_STATUS_GREEN,
    NFC_STATUS_RED,
    NFC_STATUS_GREEN,
    LDO_2V5_EN,
    BAT_SW_HOLD,
    BAT_STATUS_RED,
    BAT_STATUS_GREEN,   
};

/* Private includes ----------------------------------------------------------*/

#define STRINGIFY(x) #x
#define STRING(x) STRINGIFY(x)

/* USER CODE BEGIN Includes */
#define BMV080_SUPPORT    1
#define BME68X_SUPPORT    1

#if defined(BME68X_SUPPORT) && BME68X_SUPPORT
#include "bme68x.h"
#include "bme68x_defs.h"
#include "bsec_datatypes.h"
#include "bsec_interface.h"
#include "bme68x_function.h"
#endif


//Dev2_start
#include "stdbool.h"

#if defined(BMV080_SUPPORT) && (BMV080_SUPPORT)
#include "bmv080.h"

#endif

extern I2C_HandleTypeDef hi2c2;
extern I2C_HandleTypeDef hi2c1;

extern uint8_t ubDmaTransferStatus;
extern uint16_t   aADCxConvertedData;
extern uint8_t charRx;
#define BAT_LOWER_VAL		3600
#define BAT_HIGH_VAL		4000
#define Hex8(X)   X[0], X[1], X[2], X[3], X[4], X[5], X[6], X[7]
#define Hex4(X)   X[0], X[1], X[2], X[3]

extern void SendTxData(void);
//extern uint8_t timer_10ms;
extern uint32_t ADC_ReadChannels(uint32_t channel);
extern void GetDevAddr(uint32_t *devAddr);
extern void GetUniqueId(uint8_t *id);
extern uint16_t SYS_GetBatteryLevel(void);
extern void TxPeriodicityChanged(uint32_t periodicity);
extern void Close_Timer(void);
extern void Set_Rejoin_Time(uint32_t time);

int ext_io_ctrl(enum EXT_IO_ID id, int io_state);
void io_init(void * port, uint16_t pins);
void io_deinit(void);
void ldo_vddl_ctrl(int enable);
void ldo_2v5_ctrl(int enable);


void app_init(const char * sfot_version);
int app_task(void);
#endif
